package com.bawei.aidl_service

import android.app.Service
import android.content.Intent
import android.os.IBinder

class MyService : Service() {

    override fun onBind(intent: Intent): IBinder {
        return object :IMyAidlInterface.Stub(){
            override fun add(a: Int, b: Int, result: ResultHolder?) {
                result?.value = a+b
            }

            override fun add2(a: Int, b: Int, callback: MyCallBack?) {
                //耗时操作
                Thread{
                    Thread.sleep(10*1000)
                    callback?.result(a+b)
                }.start()
            }


        }
    }
}